package com.huabo.fxgl;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.junit.jupiter.api.Test;


/**
 * @author LiYe
 * @createTime 2022/8/1
 */
//@SpringBootTest
public class GeneratorMp {

    @Test
    public void testCreate(){
        FastAutoGenerator.create("jdbc:oracle:thin:@60.205.166.36:1521:orcl", "HBGRCTEST", "HBGRCTEST")
                .globalConfig(builder -> {
                    builder.author("LiYe") // 设置作者
//                            .enableSwagger() // 开启 swagger 模式
                            .fileOverride() // 覆盖已生成文件
                            .outputDir("D://Idea/项目"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.huabo.fxgl"); // 设置父包名
//                            .moduleName("person"); // 设置父包模块名
//                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D://")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    //设置需要生成的表名
                    builder.addInclude("TBL_BI_PAGE")
                    /*builder.addInclude("TBL_RISK"
                            ,"TBL_RISK_ASSESSMENTSTD"
                            ,"TBL_RISK_ASSPLAN"
                            ,"TBL_RISK_ASSPLAN_ATT"
                            ,"TBL_RISK_ASSPLAN_ORG"
                            ,"TBL_RISK_ASSPLAN_RISK"
                            ,"TBL_RISK_ATT"
                            ,"TBL_RISK_ATT_WORD"
                            ,"TBL_RISK_CLAIM"
                            ,"TBL_RISK_CONTROLMATRIX"
                            ,"TBL_RISK_COPING"
                            ,"TBL_RISK_COPING_CMATRIX"
                            ,"TBL_RISK_COPINGATT"
                            ,"TBL_RISK_FLOW"
                            ,"TBL_RISK_INFLUDEGREE"
                            ,"TBL_RISK_INNERRULE"
                            ,"TBL_RISK_LEVELMAPPING"
                            ,"TBL_RISK_OUTERRULE"
                            ,"TBL_RISK_POSSIBILITY"
                            ,"TBL_RISK_RECSOL_ATT"
                            ,"TBL_RISK_RECTIFYSOLUTION"
                            ,"TBL_RISK_RISK_ATT"
                            ,"TBL_RISK_RISKEVENT"
                            ,"TBL_RISK_RISKMARKING"
                            ,"TBL_RISKCATEGORY"
                            ,"TBL_RISKEVENT"
                            ,"TBL_RISKEVENT_ATT"
                            ,"TBL_RISKEVENT_FLOW"
                            ,"TBL_RISKEVENT_INNERRULE"
                            ,"TBL_RISKEVENT_MATRIX"
                            ,"TBL_RISKEVENT_OUTERRULE"
                            ,"TBL_RISKEVENT_RISK"
                            ,"TBL_RISKTOLERABILITY") //组织机构//指标表*/
                        .addTablePrefix("TBL_"); // 设置过滤表前缀
                })
                .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .execute();
    }

}
